package com.Jshop.order.service;

import com.Jshop.common.pojo.PageResult;
import com.Jshop.order.interceptor.LoginInterceptor;
import com.Jshop.order.mapper.AddressMapper;
import com.Jshop.order.mapper.OrderDetailMapper;
import com.Jshop.order.mapper.OrderMapper;
import com.Jshop.order.mapper.OrderStatusMapper;
import com.Jshop.order.pojo.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class AddressService {

    @Resource
    private AddressMapper addressMapper;

    @Resource
    private LoginInterceptor loginInterceptor;

    private static final Logger logger = LoggerFactory.getLogger(AddressService.class);


    public List<Address> queryAddrByUserName(String userName) {

        Example example = new Example(Address.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("username", userName);
        List<Address> addresses = this.addressMapper.selectByExample(example);

        if (addresses == null){
            return new ArrayList<>();
        }
        return addresses;
    }


}
